package com.yjhb.android.sbz.mvp.game;

import com.yjhb.android.sbz.entity.Game;
import com.yjhb.android.sbz.entity.ResultSet;
import com.yjhb.android.sbz.http.HttpObserver;
import com.yjhb.android.sbz.http.HttpTool;
import com.yjhb.android.sbz.mvp.ConventionPresenter;

/**
 * 创建者 zx
 * 创建时间 2021/2/3 16:07
 */
public class GamePresenter extends ConventionPresenter<GameView> {
    private final String TAG = "GamePresenter";

    public GamePresenter(GameView gameView) {
        super(gameView);
    }

    @Override
    protected void onDestroy() {

    }


    public void getGames() {
        HttpTool.request(model.getGames(50, 1), new HttpObserver<ResultSet<Game>>() {
            @Override
            public void onResult(ResultSet<Game> data) {
                if (view != null) {
                    view.onLoad(data.getRecords());
                }
            }

            @Override
            public void onError(int code, String msg) {
                if (view != null) {
                    view.onFailure(code, msg);
                }
            }
        });
    }
}
